﻿
$(document).ready(function () {
    calculateMargin();
    var galleryType = getParameterByName('galleryType');
    switch (parseInt(galleryType)) {
        case 1:
            $("#perroContent").show();
            break;
        case 2:
            $("#gatoContent").show();
            break;
        case 3:
            $("#productoContent").show();
            break;
        default:
            alert("Tipo de galería inválida");
    }
});

function calculateMargin() {
    var parentDiv = $("#tertiarySegment");
    var childDiv = $("#fieldParentDiv");

    var margin = ((parentDiv.width() + parseInt(parentDiv.css("padding-left")) + parseInt(parentDiv.css("padding-right")) +
                parseInt(parentDiv.css("margin-right")) + parseInt(parentDiv.css("margin-left"))) - (childDiv.width() + parseInt(childDiv.css("padding-left")) + parseInt(childDiv.css("padding-right")) +
                parseInt(childDiv.css("margin-right")) + parseInt(childDiv.css("margin-left")))) / 2;

    $("#fieldParentDiv").css("margin-left", margin);

};

function showModal1() {
    $("#modal1").modal("show");
};

function showModal2() {
    $("#modal2").modal("show");
};

function showModal3() {
    $("#modal3").modal("show");
};
///////////////hide modals-----
function hideModal1() {
    $("#modal1").modal("hide");
};

function hideModal2() {
    $("#modal2").modal("hide");
};

function hideModal3() {
    $("#modal3").modal("hide");
};

 

function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
};